/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * NuGat-API named Chameleon developed by Simon De Baets to Verimag.
 *
 */


package chameleon.model.automata;

import chameleon.model.NodeTrans;
import chameleon.model.formula.parser.LtlParser;
import java.io.FileNotFoundException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author simon
 */
public class Automata {

    Vector<Node> nodes_;
    Hashtable nodeTable_;

    public Automata(){nodes_ = new Vector<Node>(); nodeTable_ = new Hashtable();}

    public void addNode (Node node){
        nodes_.add (node);
        nodeTable_.put(node.getLabel(),node);
    }

    public Node getNode (String label){
        return (Node) nodeTable_.get(label);
    }

    public Vector<NodeTrans> getNuGatTransition(){
        Vector<NodeTrans> transRelation = new Vector<NodeTrans>();
        Iterator iter = nodes_.iterator();
        try {
            LtlParser ltlParser = new LtlParser();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Automata.class.getName()).log(Level.SEVERE, null, ex);
        }

        while (iter.hasNext()){

            Node node = (Node) iter.next();

            transRelation.addAll(node.getNuGatTransition());

        }


        return transRelation;
    }

}
